export class HtmlGenerate {
  createTag_(tagName, selfClosing) {
    let buffer = `<${tagName}`;
    if (selfClosing) {
      buffer += `/`;
    }
    buffer += ">";
    return buffer;
  }
  text(buffer, mnode, close) {
    if (mnode.marker) {
      //   buffer += this.createTag_('span') + escapeXml(mnode.text);
      buffer += this.createTag_("span") + mnode.text;
      buffer += this.createTag_("/span");
    } else {
      buffer += mnode.text;
    }
    return buffer;
  }
  // 加粗
  strong(buffer, mnode, close) {
    if (close) {
      buffer += this.createTag_("/strong");
    } else {
      buffer += this.createTag_("strong");
    }
    return buffer;
  }
  // 斜体
  emph(buffer, mnode, close) {
    if (close) {
      buffer += this.createTag_("/em");
    } else {
      buffer += this.createTag_("em");
    }
    return buffer;
  }
}

export default HtmlGenerate;
